﻿using System;

class SumOfFirstNMembers

            // Write a program that reads a number N and calculates the sum of the first N members of the sequence of Fibonacci: 
            // 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, …
            // Each member of the Fibonacci sequence (except the first two) is a sum of the previous two members.

{
    static void Main()
    {
            Console.Write("Enter value for 'N':");
            double n = double.Parse(Console.ReadLine());
            double a = 0;
            double b = 1;
            double sum = 1;
            Console.WriteLine("The first {0} members of the fibonacci sequence are:", n);
            for (double i = 0; i < n; i++)
            {
                double temp = a;
                a = b;
                b = temp + b;
                sum += a;
                Console.WriteLine("{0}",a);  
                 
            }
            Console.WriteLine("The sum of the first {0} members of the fibonacci sequence is {1}", n, sum);
 
        
    }
}

